package leetcode;

public class Solution28 {

    public static int strStr(String haystack, String needle) {
        int haystackLength = haystack.length();
        int needleLength = needle.length();
        for (int start = 0; start < haystackLength - needleLength + 1; start++) {
            if (haystack.substring(start, start + needleLength).equals(needle)) {
                return start;
            }
        }
        return -1;
    }

    public static void main(String[] args) {
        int index = strStr("hello", "ll");
        System.out.println(index);
    }
}
